<!-- 物流线路 - 表单编辑页面 -->
<template>
  <div class="page-container" style="padding-top: 0px;">

    <auto-config
      ref="orderNoConfig"
      config-bean="com.iml.wms.config.auto_config.WmsOrderNoAutoConfig"
      query-url="/wms-api/auto_config/WmsAutoConfigRpc/getAllConfigForms.json"
      submit-url="/wms-api/auto_config/WmsAutoConfigRpc/updateConfigValue.json"
    ></auto-config>

    <auto-config
      ref="inboundConfig"
      config-bean="com.iml.wms.config.auto_config.WmsInboundAutoConfig"
      query-url="/wms-api/auto_config/WmsAutoConfigRpc/getAllConfigForms.json"
      submit-url="/wms-api/auto_config/WmsAutoConfigRpc/updateConfigValue.json"
    ></auto-config>

    <auto-config
      ref="outboundConfig"
      config-bean="com.iml.wms.config.auto_config.WmsOutboundAutoConfig"
      query-url="/wms-api/auto_config/WmsAutoConfigRpc/getAllConfigForms.json"
      submit-url="/wms-api/auto_config/WmsAutoConfigRpc/updateConfigValue.json"
    ></auto-config>

    <div class="el-form" style="margin-bottom: 100px;"></div>

    <div class="float_bottom_submit_btns">
      <el-button type="primary" @click="submitForm()">{{ $tt('label_save') }}</el-button>
    </div>

  </div>
</template>
<script>

  import AutoConfig from '@/component/auto_config/auto-config.vue'

  export default {
    title: 'label_warehouse_sys_config',
    components: {AutoConfig},
    mixins: [],
    data() {

      return {

      };
    },

    created() {
      let _this = this
    },

    mounted() {
    },

    watch: {


    },

    computed:{

    },

    methods: {

      submitForm(){


        this.$confirm('此操作将影响业务逻辑，请谨慎操作，是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let loading = this.$loading({
          lock: true,
          text: '保存配置中',
        });
          const submitQueue = []
          submitQueue.push(this.$refs['orderNoConfig'].submitConfig())
          submitQueue.push(this.$refs['inboundConfig'].submitConfig())
          submitQueue.push(this.$refs['outboundConfig'].submitConfig())
          Promise.all(submitQueue).then((data)=>{
          if (loading) loading.close();

            this.$message({
              showClose: true,
              message: '提交成功',
              type: 'success'
            })
            this.$store.dispatch('refreshAutoConfig')
          }).catch(e=>{
          if (loading) loading.close();

            console.error(e)
          })

        }).catch(() => {

        });


      }

    }
  };

</script>
<style>

</style>
